<template>
    <div id="callBack_khfp_dfpyg_" class="container-fluid">
        <fieldset class="layui-elem-field layui-field-title" >
            <legend>待分配/已分配员工</legend>
        </fieldset>
        <table id="dfpyg" lay-filter="dfpyg"></table>
        <script type="text/html" id="callBack_khfp_dfpyg_toolbar_">
            <div id="callBack_khfp_dfpyg_toolbar_edit_" class="el-button--success el-button el-button--mini is-round" lay-event="edit" style="display: none" >编辑</div>
            <div class="el-button--primary el-button el-button--mini is-round" lay-event="refresh">刷新</div>
        </script>
    </div>
</template>
<script>
    export default {
        props: ['params','cx_','getSeleced_'],
        data:function(){
            return{
                header:[
                    {type:'checkbox', title: '选择'}
                    , {field: 'id', title: '序号', sort: true}
                    , {field: 'username', title: '姓名', sort: true}
                    , {field: 'yggh', title: '工号', sort: true}
                ],
                selectedData:"",//选中的数据
            }
        },
        watch:{
            cx_:function () {//cx_改变了就表示需要刷新界面
                //查找暂存处理列表
                this.$cache_.layuiCachedTable(this,{
                    elem: "#dfpyg"
                    , url: burl + 'crm-user/list' //数据接口
                    , toolbar: '#callBack_khfp_dfpyg_toolbar_'
                    , height: 400
                    , method:'post'
                    , where:this.$parent.params
                    , cols: [this.header]
                    , page: true //开启分页
                });
                layui.table.on('toolbar(dfpyg)', (obj)=>{
                    var checkStatus = layui.table.checkStatus(obj.config.id);
                    switch(obj.event){
                        case 'edit':
                            var data = checkStatus.data;
                            this.selectedData = data;
                            break;
                        case 'refresh':
                            this.refresh();
                            break;
                    };
                });
            },
            getSeleced_:function () {//拿到选中的
                $("#callBack_khfp_dfpyg_toolbar_edit_").click();
            },
            refresh_:function () {//刷新
                this.refresh()
            },
        },
        methods:{
            refresh:function () {//刷新客户分配
                noCheckCache = true;
                layui.table.reload("dfpyg");
            },
        }
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
    .layui-table {
         margin: 0;
    }
</style>